package top.someapp.base;

/**
 * @author zwz
 * Created on 2021-07-22
 */
public abstract class LongIdEntity implements IdEntity<Long> {

    private Long id;

    @Override public Long getId() {
        return id;
    }

    @Override public void setId(Long id) {
        this.id = id;
    }

    @Override public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        LongIdEntity that = (LongIdEntity) o;

        return id != null ? id.equals(that.id) : that.id == null;
    }

    @Override public int hashCode() {
        return id != null ? id.hashCode() : 0;
    }
}
